﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Enter.DataProxy.DbConnector;
using Enter.DataProxy.Mail.Entity;
using Enter.DataCommon;

namespace Enter.DataProxy.Mail
{
	public class DemoManager : BaseManager
    {

        public int ShowDemo()
        {
            var db = base.CreateDbReader();
            string sqltxt = "SELECT TOP 1 [id] FROM [T101_Certified]";
            return db.ExecuteScalar<int>(sqltxt);
        }

        public DataTable ShowTable(int id)
        {
            var db = base.CreateDbReader();
            string sqltxt = "SELECT TOP 10 * FROM [T101_Certified]";

            ParameterCollection parameters = CreateParameter(3);
            parameters.Append("id", id);

			IList<Certified> result = null;
			result = db.Execute<Certified>(sqltxt);

			string xx = string.Empty;

			Certified rr= result[0];

			DataTable da=db.ExecuteTable(sqltxt, parameters);
			result = null;
			result = da.ToList<Certified>();
			Certified rrr = da.First<Certified>();

			return da;

        }

		public IList<Certified> ShowEntityList()
		{
			string sqltxt = "SELECT * FROM [T101_Certified] ";


			var db = base.CreateDbReader();

			ParameterCollection parameters = db.CreateParamCollection(3);
			parameters.Append("order","id");
			parameters.Append("pageid", 1);
			parameters.Append("pagesize", 2);

			DataPage res = new DataPage();

			IList<Certified> result = null;

			res = db.ExecutePage(sqltxt, parameters);

			result = db.ExecutePage<Certified>(sqltxt, parameters);

			result = db.Execute<Certified>(sqltxt);
			//db.e
			return result;

		}


    }
}
